import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.util.FileCopyUtils;

import java.io.InputStream;

public class test1 {
    @Test
    public void accessTokenConverter() {
        //resource 验证token（公钥） authorization 产生 token （私钥）

        String s = null;
        try {

//            ClassPathResource classPathResource = new ClassPathResource("publickey/p.txt");
//            byte[] bytes = FileCopyUtils.copyToByteArray(classPathResource.getInputStream());
//            s = new String(bytes, "UTF-8");
            Resource res = new ClassPathResource("publickey");
            InputStream input = res.getInputStream();
            byte[] bytes = FileCopyUtils.copyToByteArray(res.getInputStream());
            s = new String(bytes, "UTF-8");
            System.out.println(s);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("这里有错误"+e.toString());
        }


    }
}